package com.example.flushdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.flushdemo.domain.InvFakeUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jjh
 * @since 2022-06-26
 */
@Mapper
public interface InvFakeUserMapper extends BaseMapper<InvFakeUser> {

    /**
     * 获取随机10条
     * @return
     */
    @Select(" SELECT\n" +
            "    id,\n" +
            "    ip\n" +
            "FROM\n" +
            "    inv_fake_user\n" +
            "WHERE\n" +
            "      fake_ip is not NULL\n" +
            "ORDER BY RAND()\n" +
            "LIMIT #{num}")
    List<InvFakeUser> getRandom(int num);

}
